home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIDownloadManager.idl < prev    next >
Text File  |  2006-05-08  |  7KB  |  215 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *   Blake Ross <blaker@netscape.com>
  24.  *   Ben Goodger <ben@netscape.com>
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  28.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39.  
  40. // Keeps track of ongoing downloads, in the form of nsIDownload's. 
  41.  
  42. #include "nsISupports.idl"
  43.  
  44. interface nsIDOMWindow;
  45. interface nsIURI;
  46. interface nsILocalFile;
  47. interface nsIDownload;
  48. interface nsICancelable;
  49. interface nsIMIMEInfo;
  50. interface nsIRDFDataSource;
  51. interface nsIDownloadProgressListener;
  52. interface nsISupportsArray;
  53.  
  54. [scriptable, uuid(1f280341-30f4-4009-bb0d-a78f2936d1fb)]
  55. interface nsIDownloadManager : nsISupports {
  56.   // Download States
  57.   const short DOWNLOAD_NOTSTARTED       = -1;
  58.   const short DOWNLOAD_DOWNLOADING      = 0;
  59.   const short DOWNLOAD_FINISHED         = 1;
  60.   const short DOWNLOAD_FAILED           = 2;
  61.   const short DOWNLOAD_CANCELED         = 3;
  62.   const short DOWNLOAD_PAUSED           = 4;
  63.  
  64.   const short DOWNLOAD_TYPE_DOWNLOAD    = 0;
  65.  
  66.   // Methods called by clients to carry out various managing functions
  67.  
  68.   /**
  69.    * Creates an nsIDownload and adds it to be managed by the download manager.
  70.    *
  71.    * @param aSource The source URI of the transfer. Must not be null.
  72.    *
  73.    * @param aTarget The target URI of the transfer. Must not be null.
  74.    *
  75.    * @param aDisplayName The user-readable description of the transfer.
  76.    *                     Can be empty.
  77.    *
  78.    * @param aMIMEInfo The MIME info associated with the target,
  79.    *                  including MIME type and helper app when appropriate.
  80.    *                  This parameter is optional.
  81.    *
  82.    * @param startTime Time when the download started
  83.    *
  84.    * @param aTempFile The location of a temporary file; i.e. a file in which
  85.    *                  the received data will be stored, but which is not
  86.    *                  equal to the target file. (will be moved to the real
  87.    *                  target by the caller, when the download is finished)
  88.    *                  May be null.
  89.    *
  90.    * @param aCancelable An object that can be used to abort the download.
  91.    *                    Must not be null.
  92.    *
  93.    * @return The newly created download item with the passed-in properties.
  94.    */
  95.   nsIDownload addDownload(in short aDownloadType, 
  96.                           in nsIURI aSource,
  97.                           in nsIURI aTarget,
  98.                           in AString aDisplayName,
  99.                           in AString aIconURL,
  100.                           in nsIMIMEInfo aMIMEInfo,
  101.                           in PRTime aStartTime,
  102.                           in nsILocalFile aTempFile,
  103.                           in nsICancelable aCancelable);
  104.  
  105.   /**
  106.    *  Retrieves an in-progress download managed by the download manager.
  107.    *
  108.    *  @param aPersistentDescriptor The unique identifier used to describe a
  109.    *                               a download, and an attribute of nsILocalFile.
  110.    *                               On Windows and Linux, this is just the path
  111.    *                               of the target, but on Mac this is guaranteed
  112.    *                               to be unique.
  113.    *
  114.    *  @return The download with the specified persistent descriptor.
  115.    */
  116.   nsIDownload getDownload(in wstring aPersistentDescriptor);
  117.  
  118.   /**
  119.    * Cancels the download with the specified persistent descriptor if it's
  120.    * currently in progress. This calls cancel(NS_BINDING_ABORTED) on the
  121.    * nsICancelable provided for the download.
  122.    *
  123.    * @param aPersistentDescriptor The persistent descriptor of the download to
  124.    *                              be cancelled.
  125.    */
  126.   void cancelDownload(in wstring aPersistentDescriptor);
  127.  
  128.   /**
  129.    * Removes the download with the specified persistent descriptor if it's not
  130.    * currently in progress.  Whereas cancelDownload simply cancels the transfer
  131.    * but retains information about it, removeDownload removes all knowledge of it.
  132.    *
  133.    * @param aPersistentDescriptor The persistent descriptor of the download to
  134.    *                              be removed.
  135.    */
  136.   void removeDownload(in wstring aPersistentDescriptor);
  137.  
  138.   /**
  139.    * Pause the specified download.
  140.    */
  141.   void pauseDownload(in wstring aPersistentDescriptor);
  142.  
  143.   /**
  144.    * Resume the specified download.
  145.    */
  146.   void resumeDownload(in wstring aPersistentDescriptor);
  147.  
  148.   // Front end and Front end update methods. 
  149.  
  150.   /** 
  151.    * Opens the Download Manager front end.
  152.    * 
  153.    * @param aParent   The parent, or opener, of the front end (optional).
  154.    * @param aDownload A download to pass to the manager widnow. Useful if,
  155.    *                  for example, you want the window to select a certain
  156.    *                  download (optional).
  157.    */
  158.  
  159.   void open(in nsIDOMWindow aParent, in wstring aPersistentDescriptor);
  160.  
  161.   /** 
  162.    * The Download Manager's progress listener.
  163.    */
  164.   attribute nsIDownloadProgressListener listener;
  165.  
  166.   /**
  167.   * Indicate that a batch update (e.g. mass removal) is about to start.
  168.   */
  169.  
  170.   void startBatchUpdate();
  171.   
  172.   /**
  173.   * Indicate that a batch update is ending.
  174.   */
  175.   
  176.   void endBatchUpdate();
  177.  
  178.   // Downloads list book-keeping
  179.  
  180.   /** 
  181.    * Whether or not there are downloads that can be cleaned up (removed)
  182.    * i.e. downloads that have completed, have failed or have been canceled. 
  183.    */
  184.   readonly attribute boolean canCleanUp;
  185.  
  186.   /** 
  187.    * Removes completed, failed, and canceled downloads from the list. 
  188.    */
  189.   void cleanUp();
  190.  
  191.   /** 
  192.    * The number of files currently being downloaded.
  193.    */
  194.   readonly attribute long activeDownloadCount;
  195.  
  196.   /**
  197.    * An enumeration of active downloads.
  198.    */
  199.   readonly attribute nsISupportsArray activeDownloads;
  200.  
  201.   /** 
  202.    * Update the download datasource. 
  203.    */
  204.   void saveState();
  205.  
  206.   /** 
  207.    * Flush the download datasource to disk.
  208.    */
  209.   void flush();
  210.  
  211.   readonly attribute nsIRDFDataSource datasource;
  212. };
  213.  
  214.  
  215.